<ActivityView v-deep v-bind="$attrs">
    <ActivityTitle is-app-title>编辑转储文件<span v-if="file" style="margin-left: 0.5em;">({{file}})</span></ActivityTitle>
    <ActivityBody v-if="file" style="display: flex; flex-direction: column; overflow: hidden;" @keydown.ctrl.s.extra.prevent="savefile(true)">
        <!-- <monaco-editor v-deep ref="editor" :language="'mifare_hex'"></monaco-editor> -->
        <div style="display: flex; align-items: center; justify-content: space-between;">
            <div class="left" style="display: flex; align-items: center;">
                <div v-if="!enableM1CFunc">部分功能未启用</div>
            </div>

            <div class="right" style="display: flex; align-items: center;">
                <ElCheckbox v-if="enableM1CFunc && !isMonacoMode" v-model="allowParticipateBlocks">允许不完整的块</ElCheckbox>
                <ElCheckbox v-if="!isMonacoMode" v-model="showUppercase">大写</ElCheckbox>
                <ElCheckbox v-model="isMonacoMode" :disabled="isMonacoMode">使用 Monaco Editor (实验性)</ElCheckbox>
                <ElRadio v-if="isMonacoMode" v-model="editorType" value="hex" :disabled="editorType === 'asc'">十六进制</ElRadio>
                <ElRadio v-if="isMonacoMode" v-model="editorType" value="asc" :disabled="editorType === 'asc'">ASCII</ElRadio>
                <!-- <ElRadio v-model="editorType" value="utf">UTF-8</ElRadio> -->
                <ElPopover trigger="click" width="200">
                    <template #reference>
                        <ElButton style="margin-left: 0.5em;" size="small"><ElIcon><MoreFilled /></ElIcon></ElButton>
                    </template>
                    <div style="display: flex; flex-direction: column; white-space: nowrap;">
                        <a href="#/" @click.prevent="launchTool('bcc')">BCC工具</a>
                        <a href="#/" @click.prevent="launchTool('writethis')">将此转储写入其他标签</a>
                        <a href="#/" @click.prevent="launchTool('exportkeys')">导出转储文件中的密钥</a>
                    </div>
                </ElPopover>
            </div>
        </div>
        <DumpSectorEditor v-if="!isMonacoMode" :data="editdata" :uppercase="showUppercase" :enableM1CFunc="enableM1CFunc" ref="myEditor"></DumpSectorEditor>
        <monaco-editor v-else v-deep :data="editdata" :options="Ultralight_monaco_options" ref="monaco"></monaco-editor>
        <div class="editorControls" v-deep>
            <ElButton type="primary" plain style="flex: 1;" @click="savefile(true)" :disabled="editorType === 'asc'">保存</ElButton>
            <ElButton type="danger" plain style="flex: 1;" @click="savefile(false)">放弃</ElButton>
        </div>
    </ActivityBody>
    <!-- <ActivityBody v-else-if="file && (isCompare)" style="display: flex; flex-direction: column; overflow: hidden;">
        <monaco-editor v-deep ref="editor" :language="'mifare_hex'" :create="'createDiffEditor'" :options="{
          value: '',
          roundedSelection: false,
          autoIndent: true,
          readOnly: true,
          diffWordWrap: true,
          wordWrap: 'on',
          automaticLayout: true,
          scrollBeyondLastLine: false,
          scrollbar: {
            verticalScrollbarSize: 0
          },
        }"></monaco-editor>
        <div class="editorControls" v-deep>
            <ElButton type="primary" plain style="flex: 1;" @click="savefile(false)">返回</ElButton>
        </div>
    </ActivityBody> -->
    <ActivityBody v-else>
        正在等待指定文件名...
    </ActivityBody>
    <style>
    monaco-editor>>> {
        flex: 1;
    }
    .editorControls>>> {
        padding-top: 0.5em;
        border-top: 1px solid gray;
        margin-top: 1em;
        display: flex;
    }
    </style>
</ActivityView>